\(~\) \(~\)

Nate Breznau, Lisa Heukamp & Hung H.V. Nguyen

University of Bremen


\(~\) \(~\)

DESCRIPTION

This is an appendix to our study, “Attitudes toward Redistribution Thirty Years After: Theoretical and Empirical Reflections on Svallfors’ (1997) Findings”

In 1997, Stefan Svallfors “(1997)” published, “Worlds of Welfare and Attitudes to Redistribution: A Comparison of Eight Western Nations” in which he analyzed data from the 1992 ‘Social Inequality Module’ of the International Social Survey Program (ISSP). He wanted to understand how attitudes are structured in various welfare regimes. For twenty years, his study has been a standard citation in scholarship on comparative welfare states and social policy preferences. The ISSP was the first macro-comparative survey of policy preferences, and Svallfors’ work was one of the first to compare attitudes toward redistribution in as many as eight countries using the 1992 data (there as a ISSP in 1985 but it only had 5 countries). In this paper we revisit his path-breaking work in light of theories of policy preferences. We replicate his work, we further investigate his measurement and distributional assumptions about attitudes toward redistribtuion, and we then expand his original work to include more recent waves of ISSP data.

GESIS provides the ISSP 1992 ‘Social Inequality’ data “ZA2310.dta”.

However, these data have both non-response and the response choice “Can’t choose” coded as missing (“.” in Stata). Therefore, we contaced GESIS and got the file ZA2310_2006-07-18.dta, which we suspect is likely just the old SPSS version transferred into Stata (“ZA2310_2006-07-18.sav"”)

The Original Svallfors Study

His original study used three questions:

  1. It is the responsibility of the government to reduce the differences between people with high incomes and those with low incomes? –> v57

  2. The government should provide a job for everyone who wants one? –> v59

  3. The government should provide everyone with a guaranteed basic income? –> v62

He constructed a “government index” scale from the three questions as follows:

“For this purpose, an additive index was constructed from the three items, dividing between ‘strongly agree’ and ‘agree’ (2); ‘neither agree nor disagree’ (1); and ‘disagree’ and ‘strongly disagree’ (0). These items were summed, creating an index which may vary between 0 and 6, where 0 means disagreeing with all three propositions and thereby endorsing a clear-cut anti-interventionist stand and 6 means a strong interventionist standpoint“ (Svallfors 1997: 289).

He used eight country cases:

Swe, Nor, Ger, Aut, Aus, Nz, Can, USA Theese are in v3 coded as Swe=10,Nor=9,GermanyW=2,Aut=6,Aus=1,NZ=16,Can=17,US=5


SETUP


Disclaimer

Note that this part will go in an online appendix. When we arrive at the linear models we cannot replicate his results exactly. Some of the differences are worrysome. This is not the main point of our paper. Nate contacted some colleagues at Svallfors dept. and they siad they did not expect him to have the original data or code. Nate contacted GESIS about an earlier version of the ISSP 1992 and they said they had no record of one. Nate contacted ISSP principals Jonathan Kelley and Mariah Evans about the possibility of an earlier data version, but they have not yet replied (16.03.2020)

Dataset Prep

We imported the original dataset (SocIn92) and then generate a recoded dataset (SocIn92recode). We create new variables by recoding the above mentioned variables following Svallfors workflow.

socIn92recode <- socIn92m %>%  
  dplyr::mutate(
    r1= car::recode(socIn92m$v57,recodes = '1:2=2; 3=1; 4:5=0; 8:9=NA'),
    r2= car::recode(socIn92m$v59,recodes = '1:2=2; 3=1; 4:5=0; 8:9=NA'),
    r3= car::recode(socIn92m$v62,recodes = '1:2=2; 3=1; 4:5=0; 8:9=NA'),
      
# Here we create Svallfors additive index "govermental index". Cases with at least one NA value are automatically excluded. 

     govIndex = r1+ r2+ r3,   

# to measure the percentage of people agreeing (answer category 1 and 2). Needed for table 1.     
 
    r1p= car::recode(socIn92m$v57,recodes = '1:2=100; 3:5=0'), 
    r2p= car::recode(socIn92m$v59,recodes = '1:2=100; 3:5=0'),
    r3p= car::recode(socIn92m$v62,recodes = '1:2=100; 3:5=0')
  )%>%
  
# Now we reduce our dataset to the countries Svallfors includes in his analysis (dyplr:filter).
  
   dplyr::filter(
     v3 %in% c(2,5,17,6,1,16,9,10)  
     )

# We remove all cases with NA values in the variables (complete.cases)

socIn92recode<-socIn92recode[complete.cases(socIn92recode$r1),]
socIn92recode<-socIn92recode[complete.cases(socIn92recode$r2),]
socIn92recode<-socIn92recode[complete.cases(socIn92recode$r3),]

# Second dataset, 'can't choose included'
socIn92recodem <- socIn92m %>%  
  dplyr::mutate(
    r1= car::recode(socIn92m$v57,recodes = '1:2=2; 3=1; 4:5=0; 8=8; 9=NA'),
    r2= car::recode(socIn92m$v59,recodes = '1:2=2; 3=1; 4:5=0; 8=8; 9=NA'),
    r3= car::recode(socIn92m$v62,recodes = '1:2=2; 3=1; 4:5=0; 8=8; 9=NA'))%>%
   dplyr::filter(
     v3 %in% c(2,5,17,6,1,16,9,10)  
     )

Table A. A Reproduction of “Table 1” from Svallfors (1997, p. 288)

The original Table 1

Table 1 Svallfors

Table 1 Svallfors

Now that we have prepared our variables, we construct Table 1: Attitudes to redistribution in eight nations:

# First, we creat vectors with the country means of our variables r1p, r2p, r3p (tapply).

govinc<-tapply(socIn92recode$r1p,socIn92recode$v3,mean) 
govjobs<-tapply(socIn92recode$r2p,socIn92recode$v3,mean)
govbas<-tapply(socIn92recode$r3p,socIn92recode$v3,mean)

# We make a table in form of a dataframe with the just created vectors (rbind) and sort the columns of the table following Svallfors.

table1<-as.data.frame(rbind(govinc,govjobs,govbas))
table1<-table1[,c(6,5,2,4,1,7,8,3)]   

# We create a vector with the country names in the same order (->cnt) and a vector with the questions belonging to the variables (-> item.table1). The first is used as column names, the latter as row names. 

cnt<-c("Swe","Nor","Ger","Aut","Aus","NZ","Can","USA") 
item.table1<-c("It is the responsibility of the government to reduce the differences between people with high incomes and those with low incomes?","The government should provide a job for everyone who wants one?","The government should provide everyone with a guaranteed basic income?")

row.names(table1)<-item.table1
colnames(table1) = cnt
#Finally, we creat a HTML table (knitr:kable).

t1 <- knitr::kable(table1,format="html", digits = round(1), caption = "Table 1. \"Table 1\" in Svallfors (1997): Attitudes to redistribution in eight nations. Percentage agreeing with certain propositions")

# extraKabel to better column spacing

column_spec(t1, 2:9, "4em")
Table 1. “Table 1” in Svallfors (1997): Attitudes to redistribution in eight nations. Percentage agreeing with certain propositions
Swe Nor Ger Aut Aus NZ Can USA
It is the responsibility of the government to reduce the differences between people with high incomes and those with low incomes? 52.3 60.0 65.2 69.3 42.5 53.1 47.6 38.3
The government should provide a job for everyone who wants one? 71.3 78.4 65.4 72.1 39.2 49.3 39.8 46.4
The government should provide everyone with a guaranteed basic income? 42.5 78.2 57.9 51.1 50.7 60.6 48.4 34.1

Table B. Weighted version of Svallfors’ Table 1

This table uses the dplyr::mutate function to obtain weighted means using the ISSP provided weights, we should check these at some point - are the provided for each country? are they plausible?.

socIn92recode<-socIn92recode %>%
  group_by(v3)%>% 
  dplyr::mutate(
    wmean_r1p = weighted.mean(r1p,v176),
    wmean_r2p = weighted.mean(r2p,v176),
    wmean_r3p = weighted.mean(r3p,v176))

govinc_w<-tapply(socIn92recode$wmean_r1p,socIn92recode$v3,mean) 
govjobs_w<-tapply(socIn92recode$wmean_r2p,socIn92recode$v3,mean)
govbas_w<-tapply(socIn92recode$wmean_r3p,socIn92recode$v3,mean)  

table1_w<-as.data.frame(rbind(govinc_w,govjobs_w,govbas_w))
table1_w<-table1_w[,c(6,5,2,4,1,7,8,3)]  

row.names(table1_w)<-item.table1
colnames(table1_w) = cnt

t2 <- knitr::kable(table1_w,format="html", digits = round(1), caption = "Table 2. Weighted Version of Table 1")

column_spec(t2, 2:9, "4em")
Table 2. Weighted Version of Table 1
Swe Nor Ger Aut Aus NZ Can USA
It is the responsibility of the government to reduce the differences between people with high incomes and those with low incomes? 53.2 60.6 65.2 69.8 42.5 53.1 47.8 39.2
The government should provide a job for everyone who wants one? 73.2 78.9 65.4 72.3 39.2 49.3 40.9 47.3
The government should provide everyone with a guaranteed basic income? 44.7 78.4 57.9 50.3 50.7 60.6 49.5 35.0

The Original Table 2

Table 2 Svallfors

Table 2 Svallfors

Table C. Replication of Svallfors “Table 2” (1997, p. 289).

Here we replicate Tabel 2: Index distribution in the same way we constructed Table 1.

#mean and standard deviation 
govIndexmean<-tapply(socIn92recode$govIndex,socIn92recode$v3,mean)
govIndexsd<-tapply(socIn92recode$govIndex,socIn92recode$v3,sd)

#cronbach's alpha by country (here for the recoded variable r1,r2,r3 = 394:396!)
a <- list(1,2,5,6,9,10,16,17)
cronalpha <- round(unlist(as.data.frame(sapply(a, function(x) {
  c <-socIn92recode[which(socIn92recode$v3 == x),c(394:396)]
  cronbach.alpha(c)
}))[1,]),2)
table2[3,] <- cronalpha

table2<-as.data.frame(rbind(govIndexmean,govIndexsd,cronalpha))
table2<-table2[,c(6,5,2,4,1,7,8,3)]

item.table2<-c("Mean","Standard Deviation", "Cronbach's alpha")
row.names(table2)<- item.table2
colnames(table2)<- cnt 


t3 <- knitr::kable(table2,format="html", digits = round(2), caption = "Table C. Government Index Descriptives and Alpha (replication of \"Table 2\" in Svallfors (1997)")

column_spec(t3, 2:9, "4em")
Table C. Government Index Descriptives and Alpha (replication of “Table 2” in Svallfors (1997)
Swe Nor Ger Aut Aus NZ Can USA
Mean 3.93 4.72 4.21 4.29 3.26 3.73 3.24 2.86
Standard Deviation 1.85 1.66 1.96 1.71 2.10 2.01 2.18 2.29
Cronbach’s alpha 0.64 0.64 0.70 0.52 0.70 0.63 0.73 0.79

Table D. Descrepancies in our results

From the start of this project we noticed small differences in the descriptive statistics between the original Svallfors study and ours. We suspect this is due to our usage of the GESIS 1992 ISSP data versus Svallfors’ 1992 data file which was not cleaned, standardized and archived. We plan to contact Svallfors when our work is closer to completion to ask about these descrepancies.

Appendix Table D demonstrates the differences between our results and Svallfors’ results. Panel A has unweighted and Panel B weighted differences in means.

#Now we want to compare our results for table 1 with the results of Svallfors 

#Here we create a copy of table 1 with the original values of Svallfors

table1Sval<-data.frame(matrix(c(53.7,74.1,45.5,60.0,78.3,78.4,65.5,66.3, 58.1,69.5,72.1,51.2, 42.6, 39.4, 50.9, 53.1, 49.1, 60.5, 47.9, 40.1, 48.6, 38.3, 47.1, 34.2),nrow = 3,ncol = 8))
row.names(table1Sval)<-item.table1
colnames(table1Sval) = cnt

#The deviations of our replicated table and the original table in Svallfors' article.
table1diff <- round(table1 - table1Sval,2)

#Here our weighted table versus his original table.
table1diff_w <- round(table1_w - table1Sval,2)
# Code to produce the two tables

t4a <- knitr::kable(table1diff, format="html", digits = round(3), caption = "Panel A. Unweighted Discrepancies")

column_spec(t4a, 2:9, "4em")

t4b <- knitr::kable(table1diff_w, format="html", digits = round(3), caption = "Panel B. Weighted Discrepancies")

column_spec(t4b, 2:9, "4em")

Table D. Descrepancies in Author Results versus Svallfors’ (1997) Original.

Panel A. Unweighted Discrepancies
Swe Nor Ger Aut Aus NZ Can USA
It is the responsibility of the government to reduce the differences between people with high incomes and those with low incomes? -1.45 0.04 -0.28 -0.22 -0.14 -0.05 -0.34 -0.01
The government should provide a job for everyone who wants one? -2.78 0.09 -0.93 0.01 -0.16 0.20 -0.29 -0.67
The government should provide everyone with a guaranteed basic income? -3.01 -0.15 -0.22 -0.11 -0.24 0.06 -0.19 -0.07
Panel B. Weighted Discrepancies
Swe Nor Ger Aut Aus NZ Can USA
It is the responsibility of the government to reduce the differences between people with high incomes and those with low incomes? -0.49 0.60 -0.28 0.29 -0.14 -0.05 -0.06 0.93
The government should provide a job for everyone who wants one? -0.89 0.55 -0.93 0.16 -0.16 0.20 0.84 0.22
The government should provide everyone with a guaranteed basic income? -0.81 0.04 -0.22 -0.93 -0.24 0.06 0.90 0.81

Class Scheme Coding

We attempt to replicate the Erikson, Goldthorpe and Portracrero 1979 Class Scheme. From Svallfors’ article he claims to followtheir coding scheme. We follow the EGP to the best of our ability by recoding various occupational codes provided by the countries in 1992; in other words, not all provided ISCO back then. Our resulting EGP scheme follows but does not exactly replicate Svallfors’ results. We are unsure if this is a result of the data being slight different (see Tables 1-4) or if Svallfors’ class coding scheme was different.

Svallfors provides his original SPSS coding to construct his class schemes. We will replicate this coding at some point.

#here we replicate the class scheme

#we thought we could get the scheme from the cumulative ISSP 

socIncum <- read_dta(paste(wd, "ZA5890_v1-0-0.dta", sep = ""))
socIn92new <- socIncum[which(socIncum$V5 %in% c(752, 578, 276, 40, 36, 554, 124, 840) & socIncum$V4 == 1992),] 
socIn92new <- socIn92new[,c("V3","ISCO88")]

#but there are no ISCO88 codes for 1992 so we are stuck with the Swedish coding
#It uses NYK 'Nordic Occupational Classification System

socIn92new <- dplyr::rename(socIn92new, v2 = V3)

newdata <- as.data.frame(left_join(socIn92recode, socIn92new, by = "v2"))

newdata$v110 <- car::recode(newdata$v110, recodes = '2=0')

#Here is the NYK scheme for Sweden (variable s106)
#It appears that Svallfors' original data was SEI classification (2-digit), but that provided in the ISSP from GESIS is NYK83
#we use Erik Bihagen's translation of NYK into ISCO88 [although they are not perfectly transferrable!!] http://www.camsis.stir.ac.uk/occunits/SwedishNYK8590majgpsv1.sps

newdata$isco88se <- car::recode(newdata$s106, recodes = "
1 = 2141; 2 = 2143; 3 = 2144; 4 = 2145; 5 = 3116; 6 = 3117; 7 = 2142; 8 = 2148; 9 = 3119; 12 = 3211; 13 = 3211; 14 = 2114; 15 = 2112; 16 = 2113; 19 = 3111; 21 = 2211; 22 = 3213; 23 = 3213; 29 = 2211; 30 = 1210; 31 = 2310; 32 = 2320; 33 = 2331; 34 = 2320; 35 = 2359; 36 = 2320; 37 = 2352; 39 = 2359; 41 = 2460; 49 = 3480; 51 = 2421; 52 = 2429; 53 = 2429; 
54 = 2429; 59 = 2429; 61 = 2451; 62 = 1234; 63 = 1229; 69 = 2451; 71 = 2452; 72 = 3471; 73 = 3471; 74 = 3131; 75 = 3474; 76 = 2453; 77 = 2455; 79 = 2455; 91 = 2432; 92 = 2431; 99 = 2446; 101 = 2221; 102 = 2230; 103 = 3231; 104 = 3232; 105 = 3133; 106 = 5132; 107 = 5132; 109 = 9132; 111 = 3226; 112 = 2229; 119 = 3226; 121 = 2222; 122 = 3225; 123 = 3225; 129 = 3225; 131 = 2224; 139 = 3228; 141 = 2223; 149 = 3227; 151 = 2446; 152 = 1228; 153 = 5131; 154 = 5133; 155 = 1228; 159 = 2446; 161 = 3152; 162 = 3151; 169 = 3152; 191 = 2445; 192 = 3223; 199 = 3460; 201 = 1110; 202 = 3443; 203 = 3444; 209 = 1110; 211 = 2419; 212 = 3431; 219 = 2419; 221 = 2412; 222 = 3423; 229 = 2412; 231 = 2411; 232 = 2411; 239 = 4121; 241 = 4115; 242 = 4111; 249 = 4190; 251 = 2131; 252 = 3122; 259 = 3121; 261 = 2441; 262 = 2122; 269 = 2441; 291 = 4190; 292 = 4122; 293 = 3412; 294 = 3412; 295 = 4221; 296 = 3422; 297 = 1317; 299 = 4190; 311 = 3471; 312 = 3413; 313 = 3419; 319 = 3419; 321 = 3416; 331 = 1314; 332 = 5220; 333 = 5220; 339 = 5220; 399 = 5220; 400 = 1311; 401 = 6112; 402 = 6130; 403 = 6130; 404 = 6130; 405 = 6130; 406 = 6129; 409 = 6112; 411 = 6112; 412 = 6121; 413 = 6112; 414 = 6129; 419 = 6121; 421 = 6154; 431 = 6152; 432 = 6151; 439 = 6152; 441 = 6141; 449 = 6141; 501 = 7111; 509 = 7111; 511 = 8113; 521 = 8121; 531 = 8155; 599 = 7111; 601 = 3142; 602 = 3142; 603 = 3141; 609 = 3142; 611 = 8340; 612 = 8340; 619 = 8340; 621 = 3143; 629 = 3143; 631 = 8311; 640 = 8322; 641 = 8324; 642 = 8322; 643 = 9151; 649 = 8334; 651 = 3144; 652 = 5112; 653 = 5111; 659 = 5112; 661 = 4133; 662 = 3144; 663 = 8312; 664 = 4133; 669 = 4133; 671 = 4142; 673 = 3132; 674 = 3132; 675 = 3132; 679 = 4142; 681 = 4142; 682 = 9151; 689 = 4142; 691 = 4133; 699 = 9330; 701 = 8261; 702 = 7332; 703 = 7432; 705 = 8262; 706 = 7435; 707 = 3152; 709 = 7332; 711 = 7433; 712 = 7434; 713 = 7433; 714 = 7437; 715 = 7435; 716 = 7433; 719 = 7436; 721 = 7442; 722 = 7442; 723 = 8268; 729 = 8269; 731 = 8121; 732 = 8122; 733 = 8122; 735 = 7215; 736 = 7221; 737 = 7211; 739 = 8122; 741 = 7311; 742 = 7311; 743 = 3224; 744 = 3211; 745 = 7313; 746 = 7323; 749 = 7222; 751 = 8211; 752 = 7233; 753 = 7231; 754 = 7213; 755 = 7136; 756 = 7212; 757 = 7214; 758 = 8223; 759 = 7214; 761 = 7241; 762 = 7241; 763 = 8282; 764 = 7244; 765 = 7245; 766 = 3131; 769 = 8282; 771 = 6141; 772 = 8141; 773 = 8240; 775 = 7331; 776 = 7331; 777 = 7423; 779 = 8141; 781 = 7141; 782 = 7132; 783 = 7141; 789 = 7139; 791 = 7122; 793 = 7123; 794 = 7124; 795 = 7134; 796 = 7135; 799 = 7129; 801 = 7341; 802 = 7343; 803 = 8251; 804 = 7345; 805 = 8224; 809 = 8251; 811 = 7322; 812 = 7321; 813 = 8131; 814 = 7323; 819 = 8139; 821 = 8273; 822 = 7412; 823 = 8274; 824 = 8278; 825 = 9320; 826 = 7411; 827 = 8272; 828 = 8279; 829 = 8278; 831 = 8159; 832 = 8151; 833 = 8151; 834 = 8231; 835 = 8232; 839 = 8159; 841 = 8142; 842 = 8143; 843 = 8253; 849 = 8142; 851 = 7129; 852 = 8265; 853 = 7312; 854 = 7113; 859 = 7222; 861 = 8161; 869 = 8161; 871 = 8333; 872 = 8332; 873 = 8334; 879 = 9330; 881 = 9320; 882 = 9330; 889 = 9320; 891 = 9151; 901 = 5161; 902 = 9162; 903 = 5162; 904 = 3441; 905 = 5163; 906 = 5169; 909 = 5169; 911 = 1225; 912 = 5122; 913 = 5123; 914 = 5123; 915 = 4222; 916 = 5111; 919 = 5123; 921 = 5121; 929 = 5121; 931 = 9141; 932 = 9131; 939 = 9141; 941 = 5141; 942 = 5149; 949 = 5141; 951 = 9133; 952 = 9133; 959 = 9133; 961 = 3475; 971 = 5143; 979 = 5149; 981 = 110; 989 = 110")

#now merge the imputed SE ISCO 
newdata$ISCO88 <- ifelse(newdata$v3==10,newdata$isco88se,newdata$ISCO88)

newdata$egp <- occupar::isco88toEGP(newdata$ISCO88, self.employed = newdata$v110, n.employees = newdata$v108)

newdata <- newdata %>%
  mutate(
    egp6 = car::recode(egp, recodes = '"I     Service class I" = "Service I";"II    Service class II" = "Service II"; "III.a Routine non-manual, higher grade" = "Routine"; "III.b Routine non-manual, lower grade" = "Routine"; "IV.a  Self-employed with employees" = "Self"; "IV.b  Self-employed with no empoyees" = "Self"; "IV.c  Self-employed Farmers etc" = "Self"; "V     Manual supervisors/Lower grade technicians" = "Skilled";"VI    Skilled workers" = "Skilled"; "VII.a Unskilled workers" = "Unskilled"; "VII.b Farm labours" = "Unskilled"')
  ) #V Manual supervisors = Skilled in Svallfors' coding. It's another decision he made.

Table E. Distribution of Government Index by EGP Class and Country

tableA2 <- round(as.data.frame(sapply(list(10,9,2,6,1,16,17,5), function(x) {
  d <<- newdata[which(newdata$v3 == x),]
  tapply(d$govIndex,d$egp6, mean)
  })),2)
colnames(tableA2) <- c("Swe","Nor","Ger","Aut","Aus","NZ","Can","USA")
t5 <- knitr::kable(tableA2,format="html", digits = round(2), caption = "Table E. Distribution of \'Government Index\' by EGP Class and Country. Part of Svallfors\' \"Table A2\"")

column_spec(t5, 2:9, "4em")
Table E. Distribution of ‘Government Index’ by EGP Class and Country. Part of Svallfors’ “Table A2”
Swe Nor Ger Aut Aus NZ Can USA
Routine 4.07 5.02 4.29 4.16 3.26 3.70 3.54 3.00
Self 3.21 4.25 3.54 3.94 2.60 2.84 2.98 2.10
Service I 3.12 3.65 2.98 3.90 2.55 2.67 2.47 2.03
Service II 3.47 4.44 4.02 3.43 3.08 3.54 3.46 2.40
Skilled 4.56 5.10 4.60 4.60 3.72 4.39 3.45 3.59
Unskilled 4.40 5.24 4.86 5.43 3.29 3.50 6.00 2.88

Attempt to Reproduce Results. The differences are sometimes worrysome.

Table F. Replication of Svallfors Regressions

newdata$female<-car::recode(newdata$v99, recodes = '1=0; 2=1')
newdata$empl<-car::recode(newdata$v104, recodes = '1:3=0; 5=1; c(4,6,8,9,10)=3; 7=2')

newdata$unskilled<-car::recode(newdata$egp6, recodes = '"Service I"=4; "Service II"=3; "Routine"=2; "Self"=5; "Skilled"=1;"Unskilled"=0')

m1nor<- lm(govIndex~female+factor(unskilled)+factor(empl),data = newdata, subset = (v3 %in% c(9)))

m1ger<- lm(govIndex~female+factor(unskilled)+factor(empl),data = newdata, subset = (v3 %in% c(2)))

m1aus<- lm(govIndex~female+factor(unskilled)+factor(empl),data = newdata, subset = (v3 %in% c(1)))

m1usa<- lm(govIndex~female+factor(unskilled)+factor(empl),data = newdata, subset = (v3 %in% c(5)))


table4<- stargazer(m1nor, m1ger, m1aus, m1usa, title= "Table 4",type = "text", single.row = TRUE, report = "vc*", star.cutoffs = c(0.05,0.01,0.001), covariate.labels = c("Female", "Skilled", "Routine non-manual", "Service class II", "Service class I", "Self-employed", "Unemployed", "Retired", "Others not in labor force"), column.labels = c("Norway", "Germany", "Australia", "USA"))
## 
## Table 4
## ===============================================================================================================================
##                                                                    Dependent variable:                                         
##                           -----------------------------------------------------------------------------------------------------
##                                                                         govIndex                                               
##                                    Norway                   Germany                 Australia                    USA           
##                                      (1)                      (2)                      (3)                       (4)           
## -------------------------------------------------------------------------------------------------------------------------------
## Female                            0.602***                  0.515***                  0.129                   0.604***         
## Skilled                            -0.238                    -0.116                   0.455                     0.641          
## Routine non-manual                 -0.511                   -0.655*                   -0.073                   -0.165          
## Service class II                  -0.956***                 -0.804*                   -0.188                   -0.667          
## Service class I                   -1.542***                -1.576***                  -0.675                   -0.883          
## Self-employed                     -0.979**                  -1.057**                  -0.603                   -0.743          
## Unemployed                        0.798***                   0.631*                   0.098                     0.402          
## Retired                             0.257                    0.005                    0.056                    -0.318          
## Others not in labor force           0.032                    0.197                    0.229                     0.131          
## factor(empl)99                      0.438                                             0.601*                    0.736          
## Constant                          4.984***                  4.481***                 3.158***                 2.667***         
## -------------------------------------------------------------------------------------------------------------------------------
## Observations                        1,232                    1,511                    1,671                     1,103          
## R2                                  0.122                    0.078                    0.042                     0.093          
## Adjusted R2                         0.115                    0.073                    0.036                     0.085          
## Residual Std. Error           1.593 (df = 1221)        1.890 (df = 1501)        2.062 (df = 1660)         2.188 (df = 1092)    
## F Statistic               17.020*** (df = 10; 1221) 14.128*** (df = 9; 1501) 7.244*** (df = 10; 1660) 11.196*** (df = 10; 1092)
## ===============================================================================================================================
## Note:                                                                                             *p<0.05; **p<0.01; ***p<0.001
#to make it a file

table4 %>% paste(., collapse="\n") %>% cat("\n")
## 
## Table 4
## ===============================================================================================================================
##                                                                    Dependent variable:                                         
##                           -----------------------------------------------------------------------------------------------------
##                                                                         govIndex                                               
##                                    Norway                   Germany                 Australia                    USA           
##                                      (1)                      (2)                      (3)                       (4)           
## -------------------------------------------------------------------------------------------------------------------------------
## Female                            0.602***                  0.515***                  0.129                   0.604***         
## Skilled                            -0.238                    -0.116                   0.455                     0.641          
## Routine non-manual                 -0.511                   -0.655*                   -0.073                   -0.165          
## Service class II                  -0.956***                 -0.804*                   -0.188                   -0.667          
## Service class I                   -1.542***                -1.576***                  -0.675                   -0.883          
## Self-employed                     -0.979**                  -1.057**                  -0.603                   -0.743          
## Unemployed                        0.798***                   0.631*                   0.098                     0.402          
## Retired                             0.257                    0.005                    0.056                    -0.318          
## Others not in labor force           0.032                    0.197                    0.229                     0.131          
## factor(empl)99                      0.438                                             0.601*                    0.736          
## Constant                          4.984***                  4.481***                 3.158***                 2.667***         
## -------------------------------------------------------------------------------------------------------------------------------
## Observations                        1,232                    1,511                    1,671                     1,103          
## R2                                  0.122                    0.078                    0.042                     0.093          
## Adjusted R2                         0.115                    0.073                    0.036                     0.085          
## Residual Std. Error           1.593 (df = 1221)        1.890 (df = 1501)        2.062 (df = 1660)         2.188 (df = 1092)    
## F Statistic               17.020*** (df = 10; 1221) 14.128*** (df = 9; 1501) 7.244*** (df = 10; 1660) 11.196*** (df = 10; 1092)
## ===============================================================================================================================
## Note:                                                                                             *p<0.05; **p<0.01; ***p<0.001
newdata2<- subset(newdata,v3==5)

gmean<-tapply(newdata2$govIndex,newdata2$egp,mean)
gsd<-tapply(newdata2$govIndex,newdata2$egp,sd)
table6<-as.data.frame(rbind(gmean,gsd))

knitr::kable(table6,format="html", digits = round(2), caption = "Exploring the Standard Deviations to Understand Discrepancies")
Exploring the Standard Deviations to Understand Discrepancies
I Service class I II Service class II III.a Routine non-manual, higher grade III.b Routine non-manual, lower grade IV.a Self-employed with employees IV.b Self-employed with no empoyees IV.c Self-employed Farmers etc V Manual supervisors/Lower grade technicians VI Skilled workers VII.a Unskilled workers VII.b Farm labours
gmean 2.03 2.40 2.54 3.46 2.04 2.09 2.26 3.29 3.77 2.50 3.43
gsd 2.19 2.11 2.31 2.24 2.17 2.28 1.88 2.26 2.16 2.72 1.72